package com.sram.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.sram.dao.PhotoDao;
import com.sram.entity.Photo;
import com.sram.service.PhotoService;

public class PhotoServiceImpl implements PhotoService {
	private PhotoDao photoDao;
	
	public PhotoDao getPhotoDao() {
		return photoDao;
	}

	public void setPhotoDao(PhotoDao photoDao) {
		this.photoDao = photoDao;
	}

	@Override
	public void deletePhoto(int id) {
		photoDao.deletePhoto(id);
	}

	@Override
	public void savePhoto(Photo photo) {
		photoDao.addPhoto(photo);
	}

	@Override
	public void updatePhoto(Photo photo) {
		photoDao.updatePhoto(photo);
	}

	
	@Override
	public List<Photo> findPhoto(DetachedCriteria detachedCriteria) {
		return photoDao.findPhoto(detachedCriteria);

	}

	@Override
	public List<Photo> findByDetachedCriteriaLimit(DetachedCriteria detachedCriteria, int firstResult, int pageSize) {
		// TODO Auto-generated method stub
		return  photoDao.pageQuery(detachedCriteria, firstResult, pageSize);
	}
}
